#include <stdio.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

FILE *fin;
FILE *fout;

int main()
{
    fout = fopen("data.txt", "w");
    if (NULL == fout) {
        printf("Cannot open data.out\n");
        exit(1);
    }
    int i, var;
    char filename[30], name[30];
    double v;
    for (i=2; i<=32; i+=2) {
        sprintf(filename, "tour_mpi.out_%d", i);
        fin = fopen(filename, "r");
        if (NULL == fin) {
            printf("Cannot open %s\n", filename);
            continue;
        }
        fscanf(fin, "%s %d", name, &var);
        printf("%d ", var);
        //fprintf(fout, "%d,", var);
        fscanf(fin, "%s %lf", name, &v);
        printf("%lf\n", v);
        fprintf(fout, "%lf\n", v);
        fclose(fin);
    }
    fclose(fout);
    return 0;
}